const catalog_db = [
  {
    'type': 'dir',
    'name': '学习',
    'children': [
      {
        'type': 'dir',
        'name': 'vue3',
        'children': [
          {
            'type': 'file',
            'name': 'test.md',
            'fPath': '/var/www/notebook/学习/vue3/test.md'
          }
        ],
        'fPath': '/var/www/notebook/学习/vue3',
        'folded': true
      }
    ],
    'fPath': '/var/www/notebook/学习',
    'folded': false
  }
]
const filesObj = [
  {
    'type': 'dir',
    'name': '学习',
    'children': [
      {
        'type': 'dir',
        'name': 'vue3',
        'children': [
          {
            'type': 'file',
            'name': 'test.md',
            'fPath': '/var/www/notebook/学习/vue3/test.md'
          }
        ],
        'fPath': '/var/www/notebook/学习/vue3'
      }
    ],
    'fPath': '/var/www/notebook/学习'
  }
]
const calc_item = (catalog_db, filesObj, i) => {
  console.log(`catalog_db ==> `, i, JSON.stringify(catalog_db, null, 2))
  // console.log(`filesObj ==> `, JSON.stringify(filesObj, null, 2))
  for (const filesObjKey in filesObj) {
    const db_item = catalog_db.find(item => item.fPath === filesObj[filesObjKey].fPath)
    console.log(`db_item 未赋值 ==> `, i, JSON.stringify(db_item, null, 2))
    if (db_item) {
      // console.log(`filesObj[filesObjKey]--- ==> `, JSON.stringify(filesObj[filesObjKey], null, 2))
      filesObj[filesObjKey] = Object.assign(db_item, filesObj[filesObjKey])
      console.log(`filesObj[filesObjKey]+++ ==> `, i, JSON.stringify(filesObj[filesObjKey], null, 2))
      if (filesObj[filesObjKey].children && db_item.children) {
        i++
        calc_item(db_item.children, filesObj[filesObjKey].children, i)
      }
    }
  }
}
calc_item(catalog_db, filesObj, 1)
console.log(`filesObj111[0].children ==> `, filesObj[0].children)
